import threading
import time

maxTick = 100

currentHero = []

heroList = [
    {'id': 1, 'tick': 0.00, 'speed': 0.16},
    {'id': 2, 'tick': 0.00, 'speed': 0.24},
    {'id': 3, 'tick': 0.00, 'speed': 0.31},
    {'id': 4, 'tick': 0.00, 'speed': 0.15},
    {'id': 5, 'tick': 0.00, 'speed': 0.13},
    {'id': 6, 'tick': 0.00, 'speed': 0.31},
    {'id': 7, 'tick': 0.00, 'speed': 0.11},
    {'id': 8, 'tick': 0.00, 'speed': 0.23},
]


def tick(hero):
    global currentHero
    while len(currentHero) <= 0:
        if hero['tick'] < maxTick:
            time.sleep(0.01)
            hero['tick'] += hero['speed']
            hero['tick'] = round(hero['tick'], 2)
        else:
            currentHero.append(hero)


def main():
    for hero in heroList:
        thread = threading.Thread(target=tick, args=(hero,), daemon=True)
        thread.start()
    while True:
        time.sleep(0.1)
        print("currentHero", currentHero)
        print("heroList", heroList)


if __name__ == '__main__':
    main()
